home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
os2
/
dialip10.zip
/
KILLBN.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-11-17
|
1KB
|
47 lines
/* program: killbyname (a freeby)
** written: Stan J. Towianski
** purpose: killbyname arg, will kill the 1st process that matches the
** name given in arg.
** date: 1995
** note: needs to have kill.exe program in path.
** This can be found in c:\grpware\clients from OS/2 Warp 3.0
** Also uses hardcoded filename of c:\out which can be
** changed.
*/
parse upper arg options searchname num_to_kill
tmp = value( 'TMP', , 'OS2ENVIRONMENT' )
listfile = tmp'\killbn.tmp'
'pstat /c > 'listfile
just_find_flag = 'N'
decpid = -1
if ( left( options, 1 ) \= '-' ) then
Do
num_to_kill = searchname
searchname = options
End
else if ( pos( '-F', options ) > 0 ) then
just_find_flag = 'Y'
Do While( lines( listfile ) )
word = linein( listfile )
parse var word pid . . procname rest
say "pid ="pid "procname ="procname"="
if ( pos( searchname, procname ) > 0 ) then
Do
decpid = x2d( pid )
if ( just_find_flag = 'Y' ) then
Do
say 'found name with hex pid = 'pid 'decpid = 'decpid
leave
End
"kill "decpid
leave
End
End
rc = stream( listfile, 'c', "close" )
"del "listfile
return decpid